import sys
import os
import time
import logging
logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s %(filename)s line:%(lineno)d %(levelname)s:%(message)s',
                    datefmt='%H:%M:%S',
                    )

MYPATH = os.path.dirname(os.path.realpath(__file__))
ROOTPATH = os.path.join(MYPATH, "..", "..", "common")
sys.path.append(ROOTPATH)
from ssh import Ssh



def samba(ssh):
    SAMBA = os.path.join(MYPATH, "server", "samba", "smb.conf")
    ssh.run("yum install -y python39")
    ssh.run("yum install -y samba*")
    ssh.upload(SAMBA, "/etc/samba/smb.conf")

    ssh.run("firewall-cmd --permanent --add-port=139/tcp")
    ssh.run("firewall-cmd --permanent --add-port=445/tcp")
    ssh.run("firewall-cmd --reload")
    ssh.run("setenforce 0")
    ssh.run('echo -e "123\n123" | smbpasswd -a root -s')
    ssh.run("systemctl restart smb")


ssh = Ssh("192.168.123.213")
ssh.upload(r"D:\code", "/usr1/code")